home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Bank smakow / BankSmakow.air / BankSmakow.swf / scripts / mx / effects / effectClasses / FadeInstance.as < prev    next >
Text File  |  2009-12-16  |  3KB  |  119 lines

  1. package mx.effects.effectClasses
  2. {
  3.    import flash.events.Event;
  4.    import mx.core.mx_internal;
  5.    import mx.events.FlexEvent;
  6.    
  7.    use namespace mx_internal;
  8.    
  9.    public class FadeInstance extends TweenEffectInstance
  10.    {
  11.       
  12.       mx_internal static const VERSION:String = "3.5.0.12683";
  13.        
  14.       
  15.       public var alphaFrom:Number;
  16.       
  17.       private var restoreAlpha:Boolean;
  18.       
  19.       public var alphaTo:Number;
  20.       
  21.       private var origAlpha:Number = NaN;
  22.       
  23.       public function FadeInstance(param1:Object)
  24.       {
  25.          super(param1);
  26.       }
  27.       
  28.       override public function initEffect(param1:Event) : void
  29.       {
  30.          super.initEffect(param1);
  31.          switch(param1.type)
  32.          {
  33.             case "childrenCreationComplete":
  34.             case FlexEvent.CREATION_COMPLETE:
  35.             case FlexEvent.SHOW:
  36.             case Event.ADDED:
  37.             case "resizeEnd":
  38.                if(isNaN(alphaFrom))
  39.                {
  40.                   alphaFrom = 0;
  41.                }
  42.                if(isNaN(alphaTo))
  43.                {
  44.                   alphaTo = target.alpha;
  45.                }
  46.                break;
  47.             case FlexEvent.HIDE:
  48.             case Event.REMOVED:
  49.             case "resizeStart":
  50.                restoreAlpha = true;
  51.                if(isNaN(alphaFrom))
  52.                {
  53.                   alphaFrom = target.alpha;
  54.                }
  55.                if(isNaN(alphaTo))
  56.                {
  57.                   alphaTo = 0;
  58.                }
  59.          }
  60.       }
  61.       
  62.       override public function onTweenEnd(param1:Object) : void
  63.       {
  64.          super.onTweenEnd(param1);
  65.          if(mx_internal::hideOnEffectEnd || restoreAlpha)
  66.          {
  67.             target.alpha = origAlpha;
  68.          }
  69.       }
  70.       
  71.       override public function play() : void
  72.       {
  73.          super.play();
  74.          origAlpha = target.alpha;
  75.          var _loc1_:PropertyChanges = propertyChanges;
  76.          if(isNaN(alphaFrom) && isNaN(alphaTo))
  77.          {
  78.             if(_loc1_ && _loc1_.end["alpha"] !== undefined)
  79.             {
  80.                alphaFrom = origAlpha;
  81.                alphaTo = _loc1_.end["alpha"];
  82.             }
  83.             else if(_loc1_ && _loc1_.end["visible"] !== undefined)
  84.             {
  85.                alphaFrom = !!_loc1_.start["visible"] ? Number(origAlpha) : Number(0);
  86.                alphaTo = !!_loc1_.end["visible"] ? Number(origAlpha) : Number(0);
  87.             }
  88.             else
  89.             {
  90.                alphaFrom = 0;
  91.                alphaTo = origAlpha;
  92.             }
  93.          }
  94.          else if(isNaN(alphaFrom))
  95.          {
  96.             alphaFrom = alphaTo == 0 ? Number(origAlpha) : Number(0);
  97.          }
  98.          else if(isNaN(alphaTo))
  99.          {
  100.             if(_loc1_ && _loc1_.end["alpha"] !== undefined)
  101.             {
  102.                alphaTo = _loc1_.end["alpha"];
  103.             }
  104.             else
  105.             {
  106.                alphaTo = alphaFrom == 0 ? Number(origAlpha) : Number(0);
  107.             }
  108.          }
  109.          tween = createTween(this,alphaFrom,alphaTo,duration);
  110.          target.alpha = tween.mx_internal::getCurrentValue(0);
  111.       }
  112.       
  113.       override public function onTweenUpdate(param1:Object) : void
  114.       {
  115.          target.alpha = param1;
  116.       }
  117.    }
  118. }
  119.